<template>
  <div>
    <button type="submit" class="btn btn-default btn-right" @click="deleteItem">删除</button>
    <p class="username">{{comment.username}}说：</p>
    <p class="comment">{{comment.content}}</p>
  </div>
</template>

<script>
export default {
  props: {
    comment: Object
  },
  methods: {
    deleteItem () {
      const {username} = this.comment
      if (window.confirm(`确定要删除${username}的评论吗？`)) {
        this.$emit('deleteItem')
      } else {
        alert('您已取消操作')
      }
    }
  }
}
</script>

<style>
.username {
  font-size: 20px;
}
.comment {
  padding-left: 80px;
  font-size: 15px;
}
</style>
